﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using TerminationCall.Core;

namespace TerminationCall.Editor.Logic {

    public class EraserPainter : IPainter {

        public int Size {
            private get;
            set;
        }

        public EditorToolManager EditorToolManager {
            private get;
            set;
        }

        public bool Autoborder {
            private get;
            set;
        }

        public PaintTile[] PaintTiles(Point location) {

            List<PaintTile> paintTiles = new List<PaintTile>();

            for (int x = 0; x < Size; x++) {
                for (int y = 0; y < Size; y++) {
                    if (Autoborder) {

                        AutoborderEraserPainter autoborderPainter = new AutoborderEraserPainter();
                        autoborderPainter.EditorToolManager = EditorToolManager;

                        Point point = new Point(x + location.X, y + location.Y);

                        paintTiles.AddRange(autoborderPainter.PaintTiles(point));

                    } else {
                        paintTiles.Add(EditorToolManager.SetNullTile(location.X + x, location.Y + y));
                    }
                }
            }

            return paintTiles.ToArray();
        }


    }
}
